package net.oschina.app.adapter;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import net.oschina.app.Myapp;
import net.oschina.app.R;
import net.oschina.app.util.LogUtils;

/**
 * Created by admin on 2017/7/13.
 */

public class TextAdapter extends RecyclerView.Adapter {



    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        LogUtils.d("3");
        View view = LayoutInflater.from(Myapp.mApp).inflate(R.layout.item_news, parent, false);
        ViewHodler hodler = new ViewHodler(view);
        return hodler;
    }
    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        LogUtils.d("2");
        ViewHodler hodlers = (ViewHodler) holder;
        hodlers.view.setText("aaaaaa");
    }
    @Override
    public int getItemCount() {
        LogUtils.d("1");
        return 10;
    }
    class ViewHodler extends RecyclerView.ViewHolder{
        TextView view;
        public ViewHodler(View itemView) {
            super(itemView);
            view= (TextView) itemView.findViewById(R.id.tv_name);
        }
    }
}
